package com.yuwei.goods_detail.adapter

import android.graphics.Color
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.yuwei.goods_detail.R

class CommentTopTypeAdapter:BaseQuickAdapter<String, BaseViewHolder>(R.layout.item_comment_top_type) {
    private var position = 0
    fun setPosition(position: Int) {
        this.position = position
    }
    override fun convert(holder: BaseViewHolder, item: String) {
        if (position == holder.absoluteAdapterPosition){
            holder.setText(R.id.item_comment_type_tv,item)
            holder.setBackgroundResource(R.id.item_comment_type_tv,R.drawable.item_comment_top_bg)
            holder.setTextColor(R.id.item_comment_type_tv,Color.WHITE)
        }else{
            holder.setText(R.id.item_comment_type_tv,item)
            holder.setBackgroundResource(R.id.item_comment_type_tv,R.drawable.item_comment_top_bg1)
            holder.setTextColor(R.id.item_comment_type_tv,Color.BLACK)
        }
    }
}